﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using BookStore.Bussiness;
using BookStore.Data;
using BookStore.Common;

namespace BookStore
{
    public partial class Login : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void lbtfogetpass_Click(object sender, EventArgs e)
        {
            
        }

        protected void ImageButton2_Click(object sender, ImageClickEventArgs e)
        {
            customerController cus = new customerController();

            customerInfo cusinfor = new customerInfo();
            cusinfor.email = txtemail.Text.Trim();
            cusinfor.password = encryption.toMD5(txtpass.Text.Trim());
            // adinfo.password =  txtpassword.Text.Trim();
            if (cus.CheckUser_customer(cusinfor))
            {
                Session["Customer"] = cusinfor.email.ToString();
                if (txtemail.Text != "")
                {

                }
                Response.Redirect("Success.aspx");
            }
            else
            {
                Response.Write("<script> window.alert('NOT! LOGIN SUCCESS')</script>");
            }  
        }
    }
}
